Completed
Pull Request — master (#166)
by
unknown
47s
created

helpers.js ➔ ???   A

Complexity

Conditions 1
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 0 Features 0
Metric Value
cc 1
c 5
b 0
f 0
nc 2
nop 1
dl 0
loc 9
rs 9.6666

1 Function

Rating   Name   Duplication   Size   Complexity  
A helpers.js ➔ ... ➔ ??? 0 6 2
1
const OPTIONS = [ 'ean128', 'ignoreBrackets', 'ignoreSpaces' ];
2
3
export const normalizeOptions = (options) => {
4
	OPTIONS.forEach((option) => {
5
		if (option in options) {
6
			const value = options[option];
7
			options[option] = value === true || value === 'true';
8
		}
9
	});
10
	return options;
11
};
12
13
export const formatData = (data, options) => {
14
	if (options.ignoreBrackets === true) {
15
		data = data.replace(/[()]/g, '');
16
	}
17
	if (options.ignoreSpaces === true) {
18
		data = data.replace(/ /g, '');
19
	}
20
	return data;
21
};
22